/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Neto
 */
@Entity
@Table(name = "almoxarifado", catalog = "lpoo2", schema = "")
@NamedQueries({
    @NamedQuery(name = "Almoxarifado.findAll", query = "SELECT a FROM Almoxarifado a"),
    @NamedQuery(name = "Almoxarifado.findByIdAlmoxarifado", query = "SELECT a FROM Almoxarifado a WHERE a.idAlmoxarifado = :idAlmoxarifado"),
    @NamedQuery(name = "Almoxarifado.findByNome", query = "SELECT a FROM Almoxarifado a WHERE a.nome = :nome")})
public class Almoxarifado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idAlmoxarifado")
    private Integer idAlmoxarifado;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Nome")
    private String nome;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "almoxarifado")
    private List<Estoque> estoqueList;

    public Almoxarifado() {
    }

    public Almoxarifado(Integer idAlmoxarifado) {
        this.idAlmoxarifado = idAlmoxarifado;
    }

    public Almoxarifado(Integer idAlmoxarifado, String nome) {
        this.idAlmoxarifado = idAlmoxarifado;
        this.nome = nome;
    }

    public Integer getIdAlmoxarifado() {
        return idAlmoxarifado;
    }

    public void setIdAlmoxarifado(Integer idAlmoxarifado) {
        this.idAlmoxarifado = idAlmoxarifado;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public List<Estoque> getEstoqueList() {
        return estoqueList;
    }

    public void setEstoqueList(List<Estoque> estoqueList) {
        this.estoqueList = estoqueList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAlmoxarifado != null ? idAlmoxarifado.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Almoxarifado)) {
            return false;
        }
        Almoxarifado other = (Almoxarifado) object;
        if ((this.idAlmoxarifado == null && other.idAlmoxarifado != null) || (this.idAlmoxarifado != null && !this.idAlmoxarifado.equals(other.idAlmoxarifado))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "domain.Almoxarifado[ idAlmoxarifado=" + idAlmoxarifado + " ]";
    }
    
}
